define(function (require,exports,module) {
	var angular = require('angular');
	var app = angular.module('appStore.services',[]);
	
	app.factory('appStoreService',[
		'$http',
		function ($http) {
			return {
				getAppList: function (options) {
                    options.data = options.data || {};
                    angular.extend(options.data, {NEED_TOKEN: false})
					 return $http.post(G_CONFIG["api_prefix"] +'authorization/application-store/application',options.data)
                        .success(function(res){
                            if (res && res.retCode == 0) {                               
                                options.success(res);
                                return;
                            }
                            options.fail && options.fail(res);
                        })
                        .error(function(res) {
                            options.fail && options.fail(res);
                        })
				},
				applyPackage: function (options) {
                    angular.extend(options.data, {NEED_TOKEN: false})
					return $http.post(G_CONFIG["api_prefix"] +'authorization/application-store/apply',options.data)
                        .success(function(res){
                            if (res && res.retCode == 0) {                               
                                options.success(res);
                                return;
                            }
                            options.fail && options.fail(res);
                        })
                        .error(function(res) {
                            options.fail && options.fail(res);
                        })
				},
                getPackageList: function(){
                    return [
                        {
                            id: "zsslc",
                            icon: "big_zxb",
                            name: "掌上售楼处",
                            priceDesc: "18000元/年/项目",
                            priceDetail: {
                                fee: 18000,
                                unit: "年"
                            },
                            apps: [
                                "特价秒杀",
                                "认筹理财",
                                "微楼书",
                                "预约看房",
                                "移动跟客",
                                "渠道管家"
                            ],
                            p_type: "package"
                        },
                        {
                            id: "qmyx",
                            icon: "big_tkb",
                            name: "渠道管家",
                            priceDesc: "18000元/年/项目",
                            priceDetail: {
                                fee: 20000,
                                unit: "年"
                            },
                            apps: [
                                "渠道管家",
                                "全民营销",
                                "第三方渠道",
                                "小蜜蜂"
                            ],
                            p_type: "package"
                        },
                        {
                            id: "ydxs",
                            icon: "big_gkb",
                            name: "移动销售",
                            priceDesc: "18000元/年/项目",
                            priceDetail: {
                                fee: 18000,
                                unit: "年"
                            },
                            apps: [
                                "移动跟客",
                                "销售经理"
                            ],
                            p_type: "package"
                        },
                        {
                            id: "hdyx",
                            icon: "big_hdb",
                            name: "互动传播",
                            priceDesc: "限时免费",
                            priceDetail: {
                                fee: 0,
                                unit: "年"
                            },
                            apps: [
                                "大转盘",
                                "一元秒杀",
                                "刮刮乐",
                                "抢红包",
                                "裂变红包",
                                "微场景"
                            ],
                            p_type: "package"
                        },
                        {
                            id: "dzf",
                            icon: "big_dzf",
                            name: "代支付",
                            priceDesc: "20000元/年/项目",
                            priceDetail: {
                                fee: 20000,
                                unit: "年"
                            },
                            apps: [
                                
                            ],
                            p_type: "service"
                        },
                        {
                            id: "dxb",
                            icon: "big_dxb",
                            name: "短信包",
                            priceDesc: "20000元/年/项目",
                            priceDetail: {
                                fee: 20000,
                                unit: "年"
                            },
                            apps: [
                                
                            ],
                            p_type: "service"
                        }
                    ];
                },
                getUseProjects : function(data){
                    data.NEED_TOKEN = false;
                    return $http.get(G_CONFIG["api_prefix"] +'project/auth/authorized-list&'+ $.param(data))
                }
			}	
		}
	]);
	
});